package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.entity.EoExecuteLeader;
import com.example.demo.mapper.ExecuteLeaderMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/leader")
public class ExecuteLeaderController extends BaseController{

    @Resource
    ExecuteLeaderMapper leaderMapper;

    @DeleteMapping ("/delete/{id}")
    public Result<?> delete(@PathVariable Long id){
        return Result.success(leaderMapper.deleteById(id));
    }

    @GetMapping("/list/{id}")
    public Result<?> list(@PathVariable Long id){
        List<EoExecuteLeader> leaderList = leaderMapper.selectAllById(id);
        return Result.success(leaderList);
    }

    @PostMapping("/update")
    public Result<?> update(@RequestBody EoExecuteLeader leader){
        return Result.success(leaderMapper.updateById(leader));
    }
}
